////////////////////////////////////////////////////////////////////////////////
// Filename: modelclass.h
////////////////////////////////////////////////////////////////////////////////
#ifndef _MODELCLASS_H_
#define _MODELCLASS_H_


//////////////
// INCLUDES //
//////////////
#include <d3d10.h>
#include <d3dx10.h>
#include <D3DX10Async.h>
#include <fstream>
using namespace std;

#define NewStuff 0
#define Grid 0


////////////////////////////////////////////////////////////////////////////////
// Class name: ModelClass
////////////////////////////////////////////////////////////////////////////////
class ModelClass
{
private:
	struct VertexType
	{
		D3DXVECTOR3 position;
	    D3DXVECTOR2 texture;
	};

#if NewStuff

	struct ParticleType
	{
		D3DXVECTOR3 position;
		D3DXCOLOR color;
	};

#endif

public:
	ModelClass();
	ModelClass(const ModelClass&);
	~ModelClass();

	bool Initialize(ID3D10Device*, HWND);
	void Shutdown();
	void Render(ID3D10Device*);

	void SetMatrices(D3DXMATRIX, D3DXMATRIX, D3DXMATRIX);

private:
	bool InitializeShader(ID3D10Device*, HWND);
	void ShutdownShader();

	bool InitializeBuffers(ID3D10Device*);
	void ShutdownBuffers();

	void RenderBuffers(ID3D10Device*);
	void RenderShader(ID3D10Device*);

	bool InitializeTexture(ID3D10Device*, HWND);
	void ShutdownTexture();

#if NewStuff

	bool FillParticles();

#endif

#if NewStuff

	ParticleType* Particles;

#endif

private:
	ID3D10Effect* m_effect;
	ID3D10EffectTechnique* m_technique;
	ID3D10InputLayout* m_layout;

	ID3D10EffectMatrixVariable* m_worldMatrixPtr;
	ID3D10EffectMatrixVariable* m_viewMatrixPtr;
	ID3D10EffectMatrixVariable* m_projectionMatrixPtr;

	ID3D10Buffer* m_vertexBuffer;
	ID3D10Buffer* m_indexBuffer;

#if NewStuff

	ID3D10Buffer* m_ParticleBuffer;

#endif

	int m_vertexCount;
	int m_indexCount;

#if NewStuff

	int m_ParticleCount;

#endif

	ID3D10EffectShaderResourceVariable* m_texturePtr;
	ID3D10ShaderResourceView* m_texture;
};

#endif